
import { defHttp, get } from '../utils/request';

enum Api {
  Login = '/light/login',
  phoneLogin = '/light/phoneLogin',
  Logout = '/light/logout',
  GetUserInfo = '/light/user/getUserInfo',
  // 获取系统权限
  // 1、查询用户拥有的按钮/表单访问权限
  // 2、所有权限
  // 3、系统安全模式
  GetPermCode = '/light/randomImage/',
  //新加的获取图形验证码的接口
  getInputCode = '/light/randomImage',
  //获取短信验证码的接口
  getCaptcha = '/light/sms',
  //注册接口
  registerApi = '/light/user/register',
  //校验用户接口
  checkOnlyUser = '/light/user/checkOnlyUser',
  //SSO登录校验
  validateCasLogin = '/light/cas/client/validateLogin',
  //校验手机号
  phoneVerify = '/light/user/phoneVerification',
  //修改密码
  passwordChange = '/light/user/passwordChange',
  //第三方登录
  thirdLogin = '/light/thirdLogin/getLoginUser',
  //第三方登录
  getThirdCaptcha = '/light/thirdSms',
  //获取二维码信息
  getLoginQrcode = '/light/getLoginQrcode',
  //监控二维码扫描状态
  getQrcodeToken = '/light/getQrcodeToken',
  // 公告状态
  message = '/light/message/index',
  // 已读
  messageUserRead = '/light/message/user/read',
  // 更多消息
  messageCenter = '/light/message/center',
  // 全部已读
  messageUserReadAll = '/light/message/user/read/all',
  // 获取搜索菜单
  userSearchList = '/light/permission/userSearchList',
}

// 获取验证码
export function getCodeInfo(currdatetime) {
  let url = Api.getInputCode + `/${currdatetime}`;
  return defHttp.get(url);
}
// 登录
export function login(currdatetime) {
  let url = Api.Login + `/${currdatetime}`;
  return defHttp.get(url);
}

export function loginApi(params) {
  return defHttp.post(Api.Login, params);
}
// 获取公告
export function getMessage() {
  return defHttp.get(Api.message);
}
// 已读
export function messageUserRead(params) {
  return defHttp.post(Api.messageUserRead + '?messageId=' + params.messageId);
}
// 更多消息
export function messageCenter(params) {
  return defHttp.get(Api.messageCenter, { params });
}
// 全部已读
export function messageUserReadAll(params) {
  return defHttp.post(Api.messageUserReadAll + '?type=' + params.type);
}
// 获取搜索菜单列表
export function userSearchList(params) {
  return defHttp.get(Api.userSearchList, { params });
}